package com.lightningtrade.service.impl;

import com.lightningtrade.domain.RecommendedCarousel;
import com.lightningtrade.mapper.RecommendedCarouselMapper;
import com.lightningtrade.service.RecommendedCarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RecommendedCarouselServiceImpl implements RecommendedCarouselService {

    @Autowired
    private RecommendedCarouselMapper carouselMapper;

    @Override
    public boolean addRecommendedCarousel(RecommendedCarousel carousel) {
        return carouselMapper.insertRecommendedCarousel(carousel) > 0;
    }

    @Override
    public boolean updateRecommendedCarousel(RecommendedCarousel carousel) {
        return carouselMapper.updateRecommendedCarousel(carousel) > 0;
    }

    @Override
    public boolean deleteRecommendedCarousel(int id) {
        return carouselMapper.deleteRecommendedCarouselById(id) > 0;
    }

    @Override
    public RecommendedCarousel getRecommendedCarouselById(int id) {
        return carouselMapper.selectRecommendedCarouselById(id);
    }

    @Override
    public List<RecommendedCarousel> getAllRecommendedCarousels() {
        List<RecommendedCarousel> recommendedCarousels = carouselMapper.selectAllRecommendedCarousels();

        return carouselMapper.selectAllRecommendedCarousels();
    }
}
